/*
* This file is part of WC2.
*
* WC2 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* WC2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with WC2; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*	Functions.h - Generic functions
*/

#include "allegro.h"
#include "iostream.h"
#include "fstream.h"
#include "player.h"

ofstream myfile;
int size;
char* memblock;
void open_log_file()
{
	myfile.open("log.txt");
}

void open_binary_file()
{
	myfile.open("data.bin", ios::in | ios::binary);
}

void log_to_binary_file(int c)
{
	memblock = new char[1000];
	memblock[sizeof(c)] = c;

	myfile.write((char*)memblock,sizeof(memblock));
}

void log_to_file(int c)
{
	myfile << c;
	myfile << "\n";
}

void log_to_file(char * str)
{
	myfile << str;
}


void close_log_file()
{
	myfile.close();
}

/*
void save_character(player *playr)
{
	//ifstream myFile ("data.bin", ios::in | ios::out | ios::binary);
	//myFile.seekp(0);
	//myfile.write((char*)playr->str,sizeof(playr->str));
	ofstream myFile;
	myFile.open("data.bin", ios::in | ios::binary);
	myFile.seekp(0);
	myFile.write((char*)playr->str,sizeof(player));
	myFile.close();
}
*/